Currently, an ANDROID package (APK) named DownloadProvider, which is a download manager is built in an ANDROID system, and is used to download a resource such as audio, a video, text, and an installation package.
After a user enters a website address in a client (such as a browser), the client sends a GET request to a server based on the Hypertext transfer protocol (HTTP), to obtain data from a network. The GET request method requests the server to put, into an entity data part of a packet, a resource located using a uniform resource locator (URL), to return to the client. When receiving packet header information of the packet, the client parses the packet header information to determine whether the resource requested by the GET request is a download resource or a resource in another form, such as a web page, that is, determine whether the entity data part of the packet is a download resource or a resource in another form, such as a web page resource. When the entity data part is a download resource, the client stops resource loading, and writes a download link address of the download resource into a download record database corresponding to DownloadProvider. After detecting a download request in the download record database, DownloadProvider retrieves the to-be-downloaded record, and DownloadProvider sends a GET request to the server according to the download link address in the download record. The server responds to the GET request of DownloadProvider, and the server puts the download resource into the entity data part to return to DownloadProvider. DownloadProvider parses the packet header information to determine whether the resource requested by the GET request is a download resource when receiving the packet header information. The download resource is directly downloaded from the server to a storage area using DownloadProvider if the resource is a download resource.
It can be learned that, in some other approaches, if a resource is downloaded using a request that is sent by a client and that is used to obtain a download resource, two GET requests need to be initiated to a server in an entire process in which the client requests to download the resource, and the server needs to make two responses to an electronic device, where at least packet header information needs to be returned in the two responses, to determine whether the requested resource is a download resource. The two GET requests and the two responses cause problems of increased network load and a traffic waste.